import java.util.ArrayList;

/**
 * Pixel class representing a pixel with a position and a color value, this class also provide some utility functions
 *
 */
public class Pixel {
	private int xValue;
	private int yValue;
	private int color;
	
	public Pixel(int xValue, int yValue, int color) {
		super();
		this.xValue = xValue;
		this.yValue = yValue;
		this.color = color;
	}

	public int getxValue() {
		return xValue;
	}

	public void setxValue(int xValue) {
		this.xValue = xValue;
	}

	public int getyValue() {
		return yValue;
	}

	public void setyValue(int yValue) {
		this.yValue = yValue;
	}

	public int getColor() {
		return color;
	}

	public void setColor(int color) {
		this.color = color;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + xValue;
		result = prime * result + yValue;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Pixel other = (Pixel) obj;
		if (xValue != other.xValue)
			return false;
		if (yValue != other.yValue)
			return false;
		return true;
	}
	
	public boolean isInList(ArrayList<Pixel> pixels){
		for(int i = 0; i < pixels.size(); i++){
			if(pixels.get(i).equals(this)){
				return true;
			}
		}
		return false;
	}
	
	
}
